home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
3_14.lha
/
3_14
/
3_14d.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
911b
|
45 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ case NAME:
/ ...
else if (curr_tok == LP) // function calls
{
/cerr << "prim: case NAME: LP\n"; /* DELETE */
name *n = look(name_string);
if (n->nargs == variable)
return error("not a function");
get_token(); // skip LP
double e[maxargs];
int i = 0;
if (curr_tok != RP)
e[i++] = expr();
while (curr_tok == COMMA)
{
get_token(); // skip COMMA
e[i++] = expr();
if (i == maxargs)
break;
}
if (curr_tok != RP)
return error(") expected");
get_token(); // skip RP
if (n->nargs == interp_func) // function defn
{
while (i < maxargs)
e[i++] = 0;
return interpfunc(e, n->funcdefn);
}
else if (n->nargs != i)
return error("wrong number of arguments");
else // built-in function
return (*n->funcptr)(e);
}